package itheima.com.stream;

import itheima.com.d03_hashmap.Students;

import java.util.ArrayList;
import java.util.List;

public class Test {
    public static void main(String[] args) {
        List<Student> list = new ArrayList<>();
       Student student1 = new Student("小王", 18, 66.00);
       Student student2 = new Student("小张", 18, 67.00);
       Student student3 = new Student("小李", 18, 50.00);
       Student student4 = new Student("小赵", 18, 69.00);
      list.add(student1);
      list.add(student2);
      list.add(student3);
      list.add(student4);

       list.stream().
               filter(s -> s.getScore() > 60.00)
               .sorted((s1, s2)->Double.compare(s2.getScore(),s1.getScore()))
               .forEach(s -> System.out.println(s.toString()));
        System.out.println("===================");
       list.stream().filter(s -> s.getAge() >18 )
               .filter(s -> s.getAge()<=20)
               .sorted((s1, s2)->s1.getAge()-s2.getAge())
               .forEach(s -> System.out.println(s.toString()));
    }
}
